/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package apt;

import java.util.Scanner;

/**
 *
 * @author lhminh
 */
public class HocSinh {
    // Du lieu

    private String hoTen;
    private int diemToan;
    private int diemVan;
    private double diemTrungBinh;
    // Xu ly

    public void nhap() {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Nhap ho ten: ");
        hoTen = scanner.nextLine();

        System.out.print("Nhap diem toan: ");
        diemToan = scanner.nextInt();

        System.out.print("Nhap diem van: ");
        diemVan = scanner.nextInt();
    }

    public void xuat() {
        System.out.println("Ho va ten: " + hoTen);
        System.out.println("Diem trung binh: " + diemTrungBinh);
    }

    public void tinhDiemTrungBinh() {
        diemTrungBinh = (double) (diemToan + diemVan) / 2;
        //diemTrungBinh = (diemToan + diemVan)/2.0;
    }

    public HocSinh() {
        hoTen = "";
        diemToan = 0;
        diemVan = 0;
    }
    
    public HocSinh(String ten, int toan, int van) {
        hoTen = ten;
        diemToan = toan;
        diemVan = van;
        //tinhDiemTrungBinh();
    }
    
    public HocSinh(HocSinh p) {
        hoTen = p.hoTen;
        diemToan = p.diemToan;
        diemVan = p.diemVan;
        diemTrungBinh = p.diemTrungBinh;
    }
}
